#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main() {
    int a, max, min;
    while (scanf("%d", &a) != EOF)
    {
        int arr[a];
        for (int i = 0; i < a; i++)
        {
            scanf("%d", &arr[i]);
        }
        max = arr[0];
        min = arr[0];
        for (int j = 1; j < a; j++)
        {
            if (arr[j] > max)
                max = arr[j];
            if (arr[j] < min)
                min = arr[j];
        }
        printf("%d", max - min);
    }
    return 0;
}